// MESSAGE ATT_BODY_DEBUG support class

#pragma once

namespace mavlink {
namespace fppa {
namespace msg {

/**
 * @brief ATT_BODY_DEBUG message
 *
 * ATT_BODY_DEBUG
 */
struct ATT_BODY_DEBUG : mavlink::Message {
    static constexpr msgid_t MSG_ID = 25;
    static constexpr size_t LENGTH = 144;
    static constexpr size_t MIN_LENGTH = 144;
    static constexpr uint8_t CRC_EXTRA = 223;
    static constexpr auto NAME = "ATT_BODY_DEBUG";


    float roll_obs; /*<  roll observe. */
    float pitch_obs; /*<  pitch observe. */
    float yaw_obs_mag; /*<  yaw observe with magnet. */
    float yaw_obs_rtk; /*<  yaw observe with rtk. */
    float roll_obs_sub_pred; /*<  roll observe deviation. */
    float pitch_obs_sub_pred; /*<  roll observe deviation. */
    float yaw_obs_sub_pred; /*<  roll observe deviation. */
    float f_ib_n_x; /*<  x force in B coordinate. */
    float f_ib_n_y; /*<  y force in B coordinate. */
    float f_ib_n_z; /*<  z force in B coordinate. */
    float g0_x; /*<  g0_x. */
    float g0_y; /*<  g0_y. */
    float g0_z; /*<  g0_z. */
    float declination; /*<  declination. */
    float inclination; /*<  inclination. */
    float nm_earth_x; /*<  nm_earth_x. */
    float nm_earth_y; /*<  nm_earth_y. */
    float nm_earth_z; /*<  nm_earth_z. */
    float nm_x; /*<  nm_x. */
    float nm_y; /*<  nm_y. */
    float nm_z; /*<  nm_z. */
    float RN; /*<  RN. */
    float RE; /*<  RE. */
    float v_eb_n_obs_x; /*<  v_eb_n_obs_x. */
    float v_eb_n_obs_y; /*<  v_eb_n_obs_y. */
    float v_eb_n_obs_z; /*<  v_eb_n_obs_z. */
    float p_eb_n_obs_x; /*<  p_eb_n_obs_x. */
    float p_eb_n_obs_y; /*<  p_eb_n_obs_y. */
    float p_eb_n_obs_z; /*<  p_eb_n_obs_z. */
    float w_ib_b_norm; /*<  w_ib_b_norm. */
    float f_ib_b_norm; /*<  f_ib_b_norm. */
    float bm_norm; /*<  bm_norm. */
    uint32_t time_used; /*<  used time. */
    uint32_t dt; /*<  dt. */
    uint32_t static_state; /*<  static state. */
    uint32_t disturb_state; /*<  disturb state. */


    inline std::string get_name(void) const override
    {
            return NAME;
    }

    inline Info get_message_info(void) const override
    {
            return { MSG_ID, LENGTH, MIN_LENGTH, CRC_EXTRA };
    }

    inline std::string to_yaml(void) const override
    {
        std::stringstream ss;

        ss << NAME << ":" << std::endl;
        ss << "  roll_obs: " << roll_obs << std::endl;
        ss << "  pitch_obs: " << pitch_obs << std::endl;
        ss << "  yaw_obs_mag: " << yaw_obs_mag << std::endl;
        ss << "  yaw_obs_rtk: " << yaw_obs_rtk << std::endl;
        ss << "  roll_obs_sub_pred: " << roll_obs_sub_pred << std::endl;
        ss << "  pitch_obs_sub_pred: " << pitch_obs_sub_pred << std::endl;
        ss << "  yaw_obs_sub_pred: " << yaw_obs_sub_pred << std::endl;
        ss << "  f_ib_n_x: " << f_ib_n_x << std::endl;
        ss << "  f_ib_n_y: " << f_ib_n_y << std::endl;
        ss << "  f_ib_n_z: " << f_ib_n_z << std::endl;
        ss << "  g0_x: " << g0_x << std::endl;
        ss << "  g0_y: " << g0_y << std::endl;
        ss << "  g0_z: " << g0_z << std::endl;
        ss << "  declination: " << declination << std::endl;
        ss << "  inclination: " << inclination << std::endl;
        ss << "  nm_earth_x: " << nm_earth_x << std::endl;
        ss << "  nm_earth_y: " << nm_earth_y << std::endl;
        ss << "  nm_earth_z: " << nm_earth_z << std::endl;
        ss << "  nm_x: " << nm_x << std::endl;
        ss << "  nm_y: " << nm_y << std::endl;
        ss << "  nm_z: " << nm_z << std::endl;
        ss << "  RN: " << RN << std::endl;
        ss << "  RE: " << RE << std::endl;
        ss << "  v_eb_n_obs_x: " << v_eb_n_obs_x << std::endl;
        ss << "  v_eb_n_obs_y: " << v_eb_n_obs_y << std::endl;
        ss << "  v_eb_n_obs_z: " << v_eb_n_obs_z << std::endl;
        ss << "  p_eb_n_obs_x: " << p_eb_n_obs_x << std::endl;
        ss << "  p_eb_n_obs_y: " << p_eb_n_obs_y << std::endl;
        ss << "  p_eb_n_obs_z: " << p_eb_n_obs_z << std::endl;
        ss << "  w_ib_b_norm: " << w_ib_b_norm << std::endl;
        ss << "  f_ib_b_norm: " << f_ib_b_norm << std::endl;
        ss << "  bm_norm: " << bm_norm << std::endl;
        ss << "  time_used: " << time_used << std::endl;
        ss << "  dt: " << dt << std::endl;
        ss << "  static_state: " << static_state << std::endl;
        ss << "  disturb_state: " << disturb_state << std::endl;

        return ss.str();
    }

    inline void serialize(mavlink::MsgMap &map) const override
    {
        map.reset(MSG_ID, LENGTH);

        map << roll_obs;                      // offset: 0
        map << pitch_obs;                     // offset: 4
        map << yaw_obs_mag;                   // offset: 8
        map << yaw_obs_rtk;                   // offset: 12
        map << roll_obs_sub_pred;             // offset: 16
        map << pitch_obs_sub_pred;            // offset: 20
        map << yaw_obs_sub_pred;              // offset: 24
        map << f_ib_n_x;                      // offset: 28
        map << f_ib_n_y;                      // offset: 32
        map << f_ib_n_z;                      // offset: 36
        map << g0_x;                          // offset: 40
        map << g0_y;                          // offset: 44
        map << g0_z;                          // offset: 48
        map << declination;                   // offset: 52
        map << inclination;                   // offset: 56
        map << nm_earth_x;                    // offset: 60
        map << nm_earth_y;                    // offset: 64
        map << nm_earth_z;                    // offset: 68
        map << nm_x;                          // offset: 72
        map << nm_y;                          // offset: 76
        map << nm_z;                          // offset: 80
        map << RN;                            // offset: 84
        map << RE;                            // offset: 88
        map << v_eb_n_obs_x;                  // offset: 92
        map << v_eb_n_obs_y;                  // offset: 96
        map << v_eb_n_obs_z;                  // offset: 100
        map << p_eb_n_obs_x;                  // offset: 104
        map << p_eb_n_obs_y;                  // offset: 108
        map << p_eb_n_obs_z;                  // offset: 112
        map << w_ib_b_norm;                   // offset: 116
        map << f_ib_b_norm;                   // offset: 120
        map << bm_norm;                       // offset: 124
        map << time_used;                     // offset: 128
        map << dt;                            // offset: 132
        map << static_state;                  // offset: 136
        map << disturb_state;                 // offset: 140
    }

    inline void deserialize(mavlink::MsgMap &map) override
    {
        map >> roll_obs;                      // offset: 0
        map >> pitch_obs;                     // offset: 4
        map >> yaw_obs_mag;                   // offset: 8
        map >> yaw_obs_rtk;                   // offset: 12
        map >> roll_obs_sub_pred;             // offset: 16
        map >> pitch_obs_sub_pred;            // offset: 20
        map >> yaw_obs_sub_pred;              // offset: 24
        map >> f_ib_n_x;                      // offset: 28
        map >> f_ib_n_y;                      // offset: 32
        map >> f_ib_n_z;                      // offset: 36
        map >> g0_x;                          // offset: 40
        map >> g0_y;                          // offset: 44
        map >> g0_z;                          // offset: 48
        map >> declination;                   // offset: 52
        map >> inclination;                   // offset: 56
        map >> nm_earth_x;                    // offset: 60
        map >> nm_earth_y;                    // offset: 64
        map >> nm_earth_z;                    // offset: 68
        map >> nm_x;                          // offset: 72
        map >> nm_y;                          // offset: 76
        map >> nm_z;                          // offset: 80
        map >> RN;                            // offset: 84
        map >> RE;                            // offset: 88
        map >> v_eb_n_obs_x;                  // offset: 92
        map >> v_eb_n_obs_y;                  // offset: 96
        map >> v_eb_n_obs_z;                  // offset: 100
        map >> p_eb_n_obs_x;                  // offset: 104
        map >> p_eb_n_obs_y;                  // offset: 108
        map >> p_eb_n_obs_z;                  // offset: 112
        map >> w_ib_b_norm;                   // offset: 116
        map >> f_ib_b_norm;                   // offset: 120
        map >> bm_norm;                       // offset: 124
        map >> time_used;                     // offset: 128
        map >> dt;                            // offset: 132
        map >> static_state;                  // offset: 136
        map >> disturb_state;                 // offset: 140
    }
};

} // namespace msg
} // namespace fppa
} // namespace mavlink
